
$(function () {

    $.ajax({
        url: "/market/customer/customList",      //请求接口的地址
        type: "GET",
        data: {},
        dataType: "json",
        success: function (res) {
            var uui = 0;
            var dd = res;
            for (var i in dd.data) {
                var tr1 = "<tr></tr>";
                $("#tbList").append(tr1);
                var li = $("#tbList tr").eq(i);
                uui += 1;
                var str1 = "<td>" + uui + "</td>";
                str1 += "<td id='customerName001'>" + dd.data[i].customname + "</td>";
                str1 += "<td>" + dd.data[i].sex + "</td>";
                str1 += "<td>" + dd.data[i].telephone + "</td>";
                str1 += "<td>" + dd.data[i].company + "</td>";
                str1 += "<td><span>" + dd.data[i].pname + "" + dd.data[i].cname + "</span></td>";
                str1 += "<td>" + dd.data[i].status + "</td>";
                str1 += "<td>" + dd.data[i].createtime1 + "</td>";
                str1 += "<td>" + dd.data[i].createdPerson + "</td>";
                if (dd.data[i].distractime1 == "null" || dd.data[i].distractime1 == null) {
                    str1 += "<td></td>";
                    str1 += "<td></td>";
                } else {
                    str1 += "<td>" + dd.data[i].distractime1 + "</td>";
                    str1 += "<td>" + dd.data[i].servicePerson + "</td>";
                }


                if (dd.data[i].status == "可用") {
                    str1 += ' <td>\n' +
                        '                            <a href="customerView.html" class="tablelink customName00">查看详情</a>\n' +
                        '                            <a href="customerUpdate.html" class="tablelink">修改</a>\n' +
                        '                            <a href="javascript:void(0)"  class="logout01">注销</a>\n' +
                        '                            <a href="javascript:void(0);" class="tablelink distribute01" onclick="allottipOpen()">分配</a>\n' +
                        '      </td>';

                } else {
                    str1 += '<td>\n' +
                        '          \t<a href="customerView.html" class="tablelink">查看详情</a>\n' +
                        '            <a href="javascript:void(0)" class="refresh01" >恢复</a>\n' +
                        '            <a href="javascript:void(0);" class="tablelink distribute01" onclick="allottipOpen()">分配</a>\n' +
                        '          </td>';

                }

                li.prepend(str1);


            }
            logout001()
            refresh()
            cliInfom0001()
            cliDist()
            console.log(res)
// 分页
            $('.blue').eq(0).text(res.totalRows)
            $('.blue').eq(1).text(res.pageNum)
            var total = Number(res.totalRows)
            var pageSize = Number(res.pageSize)
            var pages = total / pageSize;

            if (total % pageSize != 0) {
                pages += 1;
            }
            pageSize01 = parseInt(pages);

            var pageStr = '<li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>'
            if(pages>=3) {
                for (var i = 1; i <= pages; i++) {
                    if (i == pages - 2) {
                        pageStr += '<li class="paginItem more"><a href="javascript:;">...</a></li>'
                        pageStr += '<li class="paginItem"><a href="javascript:;">' + pages + '</a></li>'
                        break;
                    }
                    if (i == res.totalPage) {
                        pageStr += '<li class="paginItem current more" id="current01"><a href="javascript:;">' + i + '</a></li>'
                    } else {
                        pageStr += '<li class="paginItem"><a href="javascript:;">' + i + '</a></li>'
                    }
                }
            }else {
                for (var i = 1; i <= pages; i++) {
                    if (i == res.totalPage) {
                    pageStr += '<li class="paginItem current more" id="current01"><a href="javascript:;">' + i + '</a></li>'
                    } else {
                        pageStr += '<li class="paginItem"><a href="javascript:;">' + i + '</a></li>'
                    }
                }
            }

            pageStr += '<li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>'
            $('.paginList').html(pageStr)

            pageOnclik()
        },
        error: function (r) {
            alert("!!!")
        }

    })
    onclPro()
    cliInfom0001()
    selectMoreCondition()
    checkCustomName()
    logout001()
    checkCustomName02()

})


// 根据省确定城市
function onclPro() {
    $("#province").mouseout(function () {
        // var a = $("#province").children("#orderid01").html();
        var prov01 = $("#province option:selected").text();
        $.ajax({
            url: "/cityByProvince1/" + prov01,      //请求接口的地址
            type: "GET",
            success: function (res) {

                $("#city1").html("")
                var st1 = " <option>请选择城市</option>";
                $("#city1").append(st1);
                for (var i in res) {
                    // alert(res[i].cname)
                    var tr1 = "<option>" + res[i].cname + "</option>";
                    $("#city1").append(tr1);
                }
                logout001()
            }
        })

    });
}

//点击详情
function cliInfom0001() {
    $(".tablelink").click(function () {
        var b001 = $(this).parent().parent().children("#customerName001").text();
        // var b001 = $(this).parent().parent().children("#cusname01").text();
        sessionStorage.removeItem("customOneName");
        sessionStorage.setItem("customOneName", JSON.stringify(b001));
    })
}

//正则，验证名字
function checkCustomName() {
    $("#customerName").blur(function () {
        var str = $("#customerName").val();
        var han = /^[\u4e00-\u9fa5]+$/;
        if (str2==''){
            return false;
        }
        if (!han.test(str)) {
            alert("请输入公司名");
            var str = $("#customerName").val("");
            return false;
        }else {
            return true;
        }
    })
}
//正则，验证公司名字
function checkCustomName02() {
    $("#companyName").blur(function () {
        var str2 = $("#companyName").val();
        var han02 = /^[\u4e00-\u9fa5]+$/;
        if (str2==''){
            return false;
        }
        if (!han02.test(str2)) {
            alert("请输入用户名");
            var str = $("#companyName").val("");
            return false;
        }else {
            return true;
        }
    })
}

//查询
function selectMoreCondition() {
    $("#selectMoreCondition").click(function () {
        var company01 = $("#companyName").val();
        var customer01 = $("#customerName").val();
        var province = $("#province option:selected").text();
        var city1 = $("#city1 option:selected").text();
        if (province == "请选择省份") {
            province = ''
        }
        if (city1 == "请选择城市") {
            city1 = ''
        }
        var status001 = $("#status01 option:selected").val();
        if (status001 == "请选择") {
            status001 = ''
        }
        var distribute001 = $("#distribute01 option:selected").val();
        if (distribute001 == "请选择") {
            distribute001 = ''
        }
        if (status001 == '' && province == '' && company01 == '' && customer01 == '') {
            alert("请选择查询条件")
            return false;
        }
        $.ajax({
            url: "/market/customer/getMoreCondition",      //请求接口的地址
            type: "GET",
            data: {
                "company": company01,
                "customname": customer01,
                "pname": province,
                "cname": city1,
                "status": status001,
            },
            dataType: "json",
            success: function (res) {
                $("#tbList").html("")
                var uui = 0;
                var dd01 = res;
                for (var i in dd01.data) {
                    var tr1 = "<tr></tr>";
                    $("#tbList").append(tr1);
                    var li = $("#tbList tr").eq(i);
                    uui += 1;
                    var str1 = "<td>" + uui + "</td>";
                    str1 += "<td id='customerName001'>" + dd01.data[i].customname + "</td>";
                    str1 += "<td>" + dd01.data[i].sex + "</td>";
                    str1 += "<td>" + dd01.data[i].telephone + "</td>";
                    str1 += "<td>" + dd01.data[i].company + "</td>";
                    str1 += "<td><span>" + dd01.data[i].pname + "" + dd01.data[i].cname + "</span></td>";
                    str1 += "<td>" + dd01.data[i].status + "</td>";
                    str1 += "<td>" + dd01.data[i].createtime1 + "</td>";
                    str1 += "<td>" + dd01.data[i].createdPerson + "</td>";

                    if(dd01.data[i].distractime1=="null" || dd01.data[i].distractime1 == null) {
                        str1 += "<td></td>";
                        str1 += "<td></td>";
                    } else {
                        str1 += "<td>" + dd01.data[i].distractime1 + "</td>";
                        str1 += "<td>" + dd01.data[i].servicePerson + "</td>";
                    }
                    if (dd01.data[i].status == "可用") {
                        str1 += ' <td>\n' +
                            '                            <a href="customerView.html" class="tablelink customName00">查看详情</a>\n' +
                            '                            <a href="customerUpdate.html" class="tablelink">修改</a>\n' +
                            '                            <a href="javascript:void(0)"  class="logout01">注销</a>\n' +
                            '                            <a href="javascript:void(0);" class="tablelink distribute01" onclick="allottipOpen()">分配</a>\n' +
                            '      </td>';

                    } else {
                        str1 += '<td>\n' +
                            '          \t<a href="customerView.html" class="tablelink">查看详情</a>\n' +
                            '            <a href="javascript:void(0)" class="refresh01" >恢复</a>\n' +
                            '            <a href="javascript:void(0);" class="tablelink distribute01" onclick="allottipOpen()">分配</a>\n' +
                            '          </td>';

                    }
                    logout001()
                    refresh()
                    cliDist()
                    li.prepend(str1);
                }
                console.log(res)
                // logout001()

                if (res.totalRows == 0) {
                    alert("没用相关数据")
                    $('.blue').eq(0).text(0)
                    $('.blue').eq(1).text(1)
                } else {
                    $('.blue').eq(0).text(res.totalRows)
                    $('.blue').eq(1).text(res.pageNum)
                }
                // 分页
                var total = Number(res.totalRows)
                var pageSize = Number(res.pageSize)
                var pages = total / pageSize;

                if (total % pageSize != 0) {
                    pages += 1;
                }
                pageSize01 = parseInt(pages);

                var pageStr = '<li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>'
                if(pages>=3) {
                    for (var i = 1; i <= pages; i++) {
                        if (i == pages - 2) {
                            pageStr += '<li class="paginItem more"><a href="javascript:;">...</a></li>'
                            pageStr += '<li class="paginItem"><a href="javascript:;">' + pages + '</a></li>'
                            break;
                        }
                        if (i == res.totalPage) {
                            pageStr += '<li class="paginItem current more" id="current01"><a href="javascript:;">' + i + '</a></li>'
                        } else {
                            pageStr += '<li class="paginItem"><a href="javascript:;">' + i + '</a></li>'
                        }
                    }
                }else {
                    for (var i = 1; i <= pages; i++) {
                        if (i == res.totalPage) {
                            pageStr += '<li class="paginItem current more" id="current01"><a href="javascript:;">' + i + '</a></li>'
                        } else {
                            pageStr += '<li class="paginItem"><a href="javascript:;">' + i + '</a></li>'
                        }
                    }
                }
                pageStr += '<li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>'
                $('.paginList').html(pageStr)

                cliInfom0001()
                pageOnclik()
            },
            error: function (r) {
                alert("!!!")
            }

        })
    })
}




//注销
function logout001() {
    $(".logout01").click(function () {
        var b001 = $(this).parent().parent().children("#customerName001").text();
        sessionStorage.removeItem("custName002");
        sessionStorage.setItem("custName002", JSON.stringify(b001));
        sessionStorage.removeItem("mesg01");
        sessionStorage.setItem("mesg01", "0");
        tipOpen('是否确认注销此条信息？')
        // var b001 = $(this).parent().parent().children("#cusname01").text();

    })
}


//恢复
function refresh() {
    $(".refresh01").click(function () {
        var b001 = $(this).parent().parent().children("#customerName001").text();
        sessionStorage.removeItem("custName002");
        sessionStorage.setItem("custName002", JSON.stringify(b001));
        sessionStorage.removeItem("mesg01");
        sessionStorage.setItem("mesg01", "1");
        tipOpen('是否确认恢复此条信息？')
        // var b001 = $(this).parent().parent().children("#cusname01").text();

    })
}


//点击详情
function cliDist() {
    $(".distribute01").click(function () {
        var b001 = $(this).parent().parent().children("#customerName001").text();
        // var b001 = $(this).parent().parent().children("#cusname01").text();
        sessionStorage.removeItem("custname");
        sessionStorage.setItem("custname", JSON.stringify(b001));
    })
}


//分页点击
function pageOnclik() {
    $(".paginItem").click(function () {
        var click = $(this).children("a").text();
        var current = $('.blue').eq(1).text();
        var totalRow = $('.blue').eq(0).text();
        var total = Number(totalRow)
        var pageSize = Number(3)
        var pages = total / pageSize;
        if (total % pageSize != 0) {
            pages += 1;
        }
        if (current == click) {
            $(this).children("a").addClass("more")
        } else {
            if (click == "...") {
            } else if (click == '') {
                if ('<a href="javascript:;"><span class="pagepre"></span></a>' == $(this).html()) {
                    if (current != 1) {
                        current -= 1;
                        $("#tbList").html("")
                        $.ajax({
                            url: "/market/customer/customList",      //请求接口的地址
                            type: "GET",
                            data: {
                                "pageNum": current
                            },
                            dataType: "json",
                            success: function (res) {
                                var uui = 0;
                                var dd = res;
                                for (var i in dd.data) {
                                    var tr1 = "<tr></tr>";
                                    $("#tbList").append(tr1);
                                    var li = $("#tbList tr").eq(i);
                                    uui += 1;
                                    var str1 = "<td>" + uui + "</td>";
                                    str1 += "<td id='customerName001'>" + dd.data[i].customname + "</td>";
                                    str1 += "<td>" + dd.data[i].sex + "</td>";
                                    str1 += "<td>" + dd.data[i].telephone + "</td>";
                                    str1 += "<td>" + dd.data[i].company + "</td>";
                                    str1 += "<td><span>" + dd.data[i].pname + "" + dd.data[i].cname + "</span></td>";
                                    str1 += "<td>" + dd.data[i].status + "</td>";
                                    str1 += "<td>" + dd.data[i].createtime1 + "</td>";
                                    str1 += "<td>" + dd.data[i].createdPerson + "</td>";
                                    if (dd.data[i].distractime1 == "null" || dd.data[i].distractime1 == null) {
                                        str1 += "<td></td>";
                                        str1 += "<td></td>";
                                    } else {
                                        str1 += "<td>" + dd.data[i].distractime1 + "</td>";
                                        str1 += "<td>" + dd.data[i].servicePerson + "</td>";
                                    }


                                    if (dd.data[i].status == "可用") {
                                        str1 += ' <td>\n' +
                                            '                            <a href="customerView.html" class="tablelink customName00">查看详情</a>\n' +
                                            '                            <a href="customerUpdate.html" class="tablelink">修改</a>\n' +
                                            '                            <a href="javascript:void(0)"  class="logout01">注销</a>\n' +
                                            '                            <a href="javascript:void(0);" class="tablelink distribute01" onclick="allottipOpen()">分配</a>\n' +
                                            '      </td>';

                                    } else {
                                        str1 += '<td>\n' +
                                            '          \t<a href="customerView.html" class="tablelink">查看详情</a>\n' +
                                            '            <a href="javascript:void(0)" class="refresh01" >恢复</a>\n' +
                                            '            <a href="javascript:void(0);" class="tablelink distribute01" onclick="allottipOpen()">分配</a>\n' +
                                            '          </td>';

                                    }

                                    li.prepend(str1);


                                }
                                logout001()
                                refresh()
                                cliInfom0001()
                                cliDist()
// 分页
                                console.log(res)
                                $('.blue').eq(0).text(res.totalRows)
                                $('.blue').eq(1).text(res.pageNum)

                                var total = Number(res.totalRows)
                                var pageSize = Number(res.pageSize)
                                var pages = total / pageSize;

                                if (total % pageSize != 0) {
                                    pages += 1;
                                }
                                pageSize01 = parseInt(pages);

                                var pageStr = '<li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>'
                                if(pages>=3) {
                                    for (var i = 1; i <= pages; i++) {
                                        if (i == pages - 2) {
                                            pageStr += '<li class="paginItem more"><a href="javascript:;">...</a></li>'
                                            pageStr += '<li class="paginItem"><a href="javascript:;">' + pages + '</a></li>'
                                            break;
                                        }
                                        if (i == res.totalPage) {
                                            pageStr += '<li class="paginItem current more" id="current01"><a href="javascript:;">' + i + '</a></li>'
                                        } else {
                                            pageStr += '<li class="paginItem"><a href="javascript:;">' + i + '</a></li>'
                                        }
                                    }
                                }else {
                                    for (var i = 1; i <= pages; i++) {
                                        if (i == res.totalPage) {
                                            pageStr += '<li class="paginItem current more" id="current01"><a href="javascript:;">' + i + '</a></li>'
                                        } else {
                                            pageStr += '<li class="paginItem"><a href="javascript:;">' + i + '</a></li>'
                                        }
                                    }
                                }
                                pageStr += '<li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>'
                                $('.paginList').html(pageStr)

                                pageOnclik()
                            },
                            error: function (r) {
                                alert("!!!")
                            }
//
                        })
                    }
                } else {
                    if (current != pageSize01) {
                        var currentInt=parseInt(current)+1;
                        $("#tbList").html("")
                        $.ajax({
                            url: "/market/customer/customList",      //请求接口的地址
                            type: "GET",
                            data: {
                                "pageNum": currentInt
                            },
                            dataType: "json",
                            success: function (res) {
                                var uui = 0;
                                var dd = res;
                                for (var i in dd.data) {
                                    var tr1 = "<tr></tr>";
                                    $("#tbList").append(tr1);
                                    var li = $("#tbList tr").eq(i);
                                    uui += 1;
                                    var str1 = "<td>" + uui + "</td>";
                                    str1 += "<td id='customerName001'>" + dd.data[i].customname + "</td>";
                                    str1 += "<td>" + dd.data[i].sex + "</td>";
                                    str1 += "<td>" + dd.data[i].telephone + "</td>";
                                    str1 += "<td>" + dd.data[i].company + "</td>";
                                    str1 += "<td><span>" + dd.data[i].pname + "" + dd.data[i].cname + "</span></td>";
                                    str1 += "<td>" + dd.data[i].status + "</td>";
                                    str1 += "<td>" + dd.data[i].createtime1 + "</td>";
                                    str1 += "<td>" + dd.data[i].createdPerson + "</td>";
                                    if (dd.data[i].distractime1 == "null" || dd.data[i].distractime1 == null) {
                                        str1 += "<td></td>";
                                        str1 += "<td></td>";
                                    } else {
                                        str1 += "<td>" + dd.data[i].distractime1 + "</td>";
                                        str1 += "<td>" + dd.data[i].servicePerson + "</td>";
                                    }


                                    if (dd.data[i].status == "可用") {
                                        str1 += ' <td>\n' +
                                            '                            <a href="customerView.html" class="tablelink customName00">查看详情</a>\n' +
                                            '                            <a href="customerUpdate.html" class="tablelink">修改</a>\n' +
                                            '                            <a href="javascript:void(0)"  class="logout01">注销</a>\n' +
                                            '                            <a href="javascript:void(0);" class="tablelink distribute01" onclick="allottipOpen()">分配</a>\n' +
                                            '      </td>';

                                    } else {
                                        str1 += '<td>\n' +
                                            '          \t<a href="customerView.html" class="tablelink">查看详情</a>\n' +
                                            '            <a href="javascript:void(0)" class="refresh01" >恢复</a>\n' +
                                            '            <a href="javascript:void(0);" class="tablelink distribute01" onclick="allottipOpen()">分配</a>\n' +
                                            '          </td>';

                                    }

                                    li.prepend(str1);


                                }
                                logout001()
                                refresh()
                                cliInfom0001()
                                cliDist()
// 分页
                                $('.blue').eq(0).text(res.totalRows)
                                $('.blue').eq(1).text(res.pageNum)
                                var total = Number(res.totalRows)
                                var pageSize = Number(res.pageSize)
                                var pages = total / pageSize;

                                if (total % pageSize != 0) {
                                    pages += 1;
                                }
                                pageSize01 = parseInt(pages);

                                var pageStr = '<li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>'
                                if(pages>=3) {
                                    for (var i = 1; i <= pages; i++) {
                                        if (i == pages - 2) {
                                            pageStr += '<li class="paginItem more"><a href="javascript:;">...</a></li>'
                                            pageStr += '<li class="paginItem"><a href="javascript:;">' + pages + '</a></li>'
                                            break;
                                        }
                                        if (i == res.totalPage) {
                                            pageStr += '<li class="paginItem current more" id="current01"><a href="javascript:;">' + i + '</a></li>'
                                        } else {
                                            pageStr += '<li class="paginItem"><a href="javascript:;">' + i + '</a></li>'
                                        }
                                    }
                                }else {
                                    for (var i = 1; i <= pages; i++) {
                                        if (i == res.totalPage) {
                                            pageStr += '<li class="paginItem current more" id="current01"><a href="javascript:;">' + i + '</a></li>'
                                        } else {
                                            pageStr += '<li class="paginItem"><a href="javascript:;">' + i + '</a></li>'
                                        }
                                    }
                                }
                                pageStr += '<li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>'
                                $('.paginList').html(pageStr)

                                pageOnclik()
                            },
                            error: function (r) {
                                alert("!!!")
                            }
//
                        })
                    }
                }


            } else {
                $("#tbList").html("")
                $.ajax({
                    url: "/market/customer/customList",      //请求接口的地址
                    type: "GET",
                    data: {
                        "pageNum": click
                    },
                    dataType: "json",
                    success: function (res) {
                        var uui = 0;
                        var dd = res;
                        for (var i in dd.data) {
                            var tr1 = "<tr></tr>";
                            $("#tbList").append(tr1);
                            var li = $("#tbList tr").eq(i);
                            uui += 1;
                            var str1 = "<td>" + uui + "</td>";
                            str1 += "<td id='customerName001'>" + dd.data[i].customname + "</td>";
                            str1 += "<td>" + dd.data[i].sex + "</td>";
                            str1 += "<td>" + dd.data[i].telephone + "</td>";
                            str1 += "<td>" + dd.data[i].company + "</td>";
                            str1 += "<td><span>" + dd.data[i].pname + "" + dd.data[i].cname + "</span></td>";
                            str1 += "<td>" + dd.data[i].status + "</td>";
                            str1 += "<td>" + dd.data[i].createtime1 + "</td>";
                            str1 += "<td>" + dd.data[i].createdPerson + "</td>";
                            if (dd.data[i].distractime1 == "null" || dd.data[i].distractime1 == null) {
                                str1 += "<td></td>";
                                str1 += "<td></td>";
                            } else {
                                str1 += "<td>" + dd.data[i].distractime1 + "</td>";
                                str1 += "<td>" + dd.data[i].servicePerson + "</td>";
                            }


                            if (dd.data[i].status == "可用") {
                                str1 += ' <td>\n' +
                                    '                            <a href="customerView.html" class="tablelink customName00">查看详情</a>\n' +
                                    '                            <a href="customerUpdate.html" class="tablelink">修改</a>\n' +
                                    '                            <a href="javascript:void(0)"  class="logout01">注销</a>\n' +
                                    '                            <a href="javascript:void(0);" class="tablelink distribute01" onclick="allottipOpen()">分配</a>\n' +
                                    '      </td>';

                            } else {
                                str1 += '<td>\n' +
                                    '          \t<a href="customerView.html" class="tablelink">查看详情</a>\n' +
                                    '            <a href="javascript:void(0)" class="refresh01" >恢复</a>\n' +
                                    '            <a href="javascript:void(0);" class="tablelink distribute01" onclick="allottipOpen()">分配</a>\n' +
                                    '          </td>';

                            }

                            li.prepend(str1);


                        }
                        logout001()
                        refresh()
                        cliInfom0001()
                        cliDist()
// 分页
                        $('.blue').eq(0).text(res.totalRows)
                        $('.blue').eq(1).text(res.pageNum)
                        var total = Number(res.totalRows)
                        var pageSize = Number(res.pageSize)
                        var pages = total / pageSize;

                        if (total % pageSize != 0) {
                            pages += 1;
                        }
                        pageSize01 = parseInt(pages);

                        var pageStr = '<li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>'
                        if(pages>=3) {
                            for (var i = 1; i <= pages; i++) {
                                if (i == pages - 2) {
                                    pageStr += '<li class="paginItem more"><a href="javascript:;">...</a></li>'
                                    pageStr += '<li class="paginItem"><a href="javascript:;">' + pages + '</a></li>'
                                    break;
                                }
                                if (i == res.totalPage) {
                                    pageStr += '<li class="paginItem current more" id="current01"><a href="javascript:;">' + i + '</a></li>'
                                } else {
                                    pageStr += '<li class="paginItem"><a href="javascript:;">' + i + '</a></li>'
                                }
                            }
                        }else {
                            for (var i = 1; i <= pages; i++) {
                                if (i == res.totalPage) {
                                    pageStr += '<li class="paginItem current more" id="current01"><a href="javascript:;">' + i + '</a></li>'
                                } else {
                                    pageStr += '<li class="paginItem"><a href="javascript:;">' + i + '</a></li>'
                                }
                            }
                        }
                        pageStr += '<li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>'
                        $('.paginList').html(pageStr)

                        pageOnclik()
                    },
                    error: function (r) {
                        alert("!!!")
                    }
//
                })
            }
        }

    })
}



